<html>
<head>
    <meta http-equiv="content-type" content="text/html;charset=utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1"/> 
    <title>微信支付样例-支付</title>
    <script type="text/javascript">
	//调用微信JS api 支付
	function jsApiCall()
	{
		WeixinJSBridge.invoke(
			'getBrandWCPayRequest',
                {$jsApiParameters},
			function(res){
//				WeixinJSBridge.log(res.err_msg);
//				alert(res.err_code+res.err_desc+res.err_msg);
//				alert(res.err_msg);
                                if (res.err_msg == 'get_brand_wcpay_request:ok') {
                                    window.location.href="{$sqlData[returnurl]}&paid={$sqlData[orderid]}";
                                }else if (res.err_msg == 'get_brand_wcpay_request:cancel') {
                                    alert('支付取消');
                                    history.back();
                                }else if (res.err_msg == 'get_brand_wcpay_request:fail') {
                                    alert('支付失败，请返回重试');
                                    history.back();
                                }
			}
		);
	}

	function callpay()
	{
		if (typeof WeixinJSBridge == "undefined"){
		    if( document.addEventListener ){
		        document.addEventListener('WeixinJSBridgeReady', jsApiCall, false);
		    }else if (document.attachEvent){
		        document.attachEvent('WeixinJSBridgeReady', jsApiCall); 
		        document.attachEvent('onWeixinJSBridgeReady', jsApiCall);
		    }
		}else{
		    jsApiCall();
		}
	}
        
        callpay();
	</script>
	<script type="text/javascript">
	//获取共享地址
//	function editAddress()
//	{
//		WeixinJSBridge.invoke(
//			'editAddress',
//			<?php echo $editAddress; ?>,
//			function(res){
//				var value1 = res.proviceFirstStageName;
//				var value2 = res.addressCitySecondStageName;
//				var value3 = res.addressCountiesThirdStageName;
//				var value4 = res.addressDetailInfo;
//				var tel = res.telNumber;
//				
//				alert(value1 + value2 + value3 + value4 + ":" + tel);
//			}
//		);
//	}
//	
//	window.onload = function(){
//		if (typeof WeixinJSBridge == "undefined"){
//		    if( document.addEventListener ){
//		        document.addEventListener('WeixinJSBridgeReady', editAddress, false);
//		    }else if (document.attachEvent){
//		        document.attachEvent('WeixinJSBridgeReady', editAddress); 
//		        document.attachEvent('onWeixinJSBridgeReady', editAddress);
//		    }
//		}else{
//			editAddress();
//		}
//	};
//	
	</script>
</head>
<body>
    <br/>
	<div align="center">
		<div style="width:210px; height:50px; border-radius: 15px;background-color:#FE6714; border:0px #FE6714 solid; cursor: pointer;  color:white;  font-size:16px;"  >支付进行中</div>
	</div>
</body>
</html>